﻿using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Xml;
using XamlDom;
using XamlDom.Parser;

namespace XamlDomTest
{
    [TestClass]
    public class XamlParserFixture
    {
        [TestMethod]
        public void ReadXmlTest()
        {
            string xamlStr = @"<Page
                                xmlns=""http://schemas.microsoft.com/netfx/2007/xaml/presentation""
                                xmlns:x=""http://schemas.microsoft.com/winfx/2006/xaml"">
                              <StackPanel Background=""LightBlue"" Orientation=""Vertical"">
                                <TextBlock Margin=""10,10,10,10"" Text=""sunyanfei""></TextBlock>
                                <TextBlock Margin=""10,10,10,10"" Text=""sunyanfei""></TextBlock>
                              </StackPanel>
                            </Page>";
            XamlParser parser = new XamlParser(xamlStr);
            XamlNode rootNode = parser.Parse();

            Assert.IsNotNull(rootNode);
            Assert.AreEqual(rootNode.LastChildNode.ChildElementNodes.Count, 2);
        }
    }
}
